Total Complexity | 2 |
Total Lines | 15 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | /** |
||
15 | |||
16 | /** |
||
17 | * Simple config class that allows to retrieve and overwrite application config set by environment in window.__config__ |
||
18 | */ |
||
19 | export class AppConfig<T extends {}> { |
||
20 | private config: T; |
||
21 | public constructor() { |
||
22 | // @ts-ignore |
||
23 | this.config = window['__config__'] || {}; |
||
24 | } |
||
25 | public get<K extends keyof T>(key: K): T[K] { |
||
26 | return this.config[key]; |
||
27 | } |
||
28 | public set(setConfig: Partial<T>): void { |
||
29 | this.config = merge(this.config, setConfig); |
||
30 | } |
||
36 |